﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Audit_Configuration_Oracle.DAL;

namespace Audit_Configuration_Oracle.Controllers
{
    public class NewRuleController
    {
        public static List<string> GetUserList(){
            List<string> users = null;
            try
            {
                users = NewRuleDAL.GetUserList();
            }
            catch (Exception e)
            {
                throw e;
            }

            return users;
        }

        public static List<string> GetTableList()
        {
            List<string> table = null;
            try
            {
                table = NewRuleDAL.GetTableList();
            }
            catch (Exception e)
            {
                throw e;
            }

            return table;
        }

        public static bool SaveNewRule(string rule, List<string> operations, string target, string condition1, string condition2)
        {
            bool result = false;
            try
            {
                result = NewRuleDAL.SaveNewRule( rule, operations,  target,  condition1,  condition2);
            }
            catch (Exception e)
            {
                throw e;
            }
            return result;
        }

        public static bool SaveNewRulePrivilege(string rule, List<string> operations, string target, string condition1, string condition2)
        {
            bool result = false;
            try
            {
                result = NewRuleDAL.SaveNewRulePrivilege(rule, operations, target, condition1, condition2);
            }
            catch (Exception e)
            {
                throw e;
            }
            return result;
        }
    }
}
